//package com.soilflow.runner;
//
//import com.soilflow.common.core.redis.RedisCache;
//import com.soilflow.common.domain.DahuConvenient;
//import com.soilflow.info.mapper.DahuConvenientMapper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
//@Component
//public class ViewCountRunner implements CommandLineRunner {
//    @Resource
//    private DahuConvenientMapper convenientMapper;
//    @Autowired
//    private RedisCache redisCache;
//
//    @Override
//    public void run(String... args) throws Exception {
//        List<DahuConvenient> DahuConvenients = convenientMapper.selectList(null);
//        Map<String, Integer> viewCountMap = DahuConvenients.stream()
//                .collect(Collectors.toMap(DahuConvenient -> DahuConvenient.getId().toString(), DahuConvenient -> {
//                    return DahuConvenient.getNumber().intValue();//
//                }));
//        redisCache.setCacheMap("DahuConvenient:number",viewCountMap);
//    }
//}
